﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace _MetalSlug.Form.MenuScreen
{
    public class DisplayHover: MySprite
    {
        public const int TimeDelay = 100;
        public enum STATE
        {
            ACTIVE,
            CHOSEN
        }

        STATE currentState;

        public STATE CurrentState
        {
            get { return currentState; }
            set 
            { 
                currentState = value;
                if (CurrentState == STATE.CHOSEN)
                {
                    Textures = ChosenTextures;
                }
                else
                {
                    Textures = ActiveTextures;
                }
            }
        }

        List<Texture2D> ActiveTextures;
        List<Texture2D> ChosenTextures;

        public DisplayHover()
        {
            ActiveTextures = GameUtil.LoadTextures("MainMenu/hover", 2);
            ChosenTextures = GameUtil.LoadTextures("MainMenu/elder", 10);
            CurrentState = STATE.ACTIVE;
        }

        public override void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.Milliseconds % TimeDelay != 0)
            {
                return;
            }

            nextFrame();
        }

        public void SetPosition(Vector2 newPos)
        {
            TopLeft = newPos;
        }

        public Boolean CanBeSwitchScreen()
        {
            if(CurrentState == STATE.CHOSEN && isLastFrame())
            {
                return true;
            }

            return false;
        }
    }
}
